﻿@using System.Globalization
@model  PagedList.IPagedList<CultuRAM.Models.AccreditingRequest>

@{
    ViewBag.Title = "Index";
}

<h4><i class="icon-list" style="margin-top: 3px;"></i> Pedidos de Adesão</h4>


<table id="tabAccReq" class="table table-hover table-striped table-bordered" style="width:100%;">
    <tr style="font-size: 12px">
        <th>
            @Html.DisplayNameFor(model => model.First().RequestDate)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Entity.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Entity.EntityType.EntityTypeName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Entity.Responsible)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().AccreditingState.AccState)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().RequestCode)
        </th>
 
    </tr>

@foreach (var item in Model) {
    <tr id="@item.AccReqId">
        <td>
            @Html.DisplayName(item.RequestDate.ToString("dd/MM/yyyy HH:00", CultureInfo.InvariantCulture))
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Entity.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Entity.EntityType.EntityTypeName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Entity.Responsible)
        </td>
        <td style="text-align: left;">
            @*@Html.DisplayFor(modelItem => item.AccreditingState.AccState)*@
            @switch (item.AccreditingState.AccState)
                             {
                                 case "Pendente":
                                     <span class="label label-warning"> @item.AccreditingState.AccState </span>
                                     break;
                                 case "Em análise":
                                     <span class="label label-info"> @item.AccreditingState.AccState </span>
                                     break;
                                 case "Aceite":
                                     <span class="label label-success"> @item.AccreditingState.AccState </span>
                                     break;
                                 case "Recusado":
                                     <span class="label label-important"> @item.AccreditingState.AccState </span>
                                     break;
                                 default:
                                     <span class="label"> @item.AccreditingState.AccState </span>
                                     break;
                             }
        </td>
        <td style="text-align: center;">
            @Html.DisplayFor(modelItem => item.RequestCode)
        </td>
@*        <td>
            @Html.ActionLink("E", "Edit", new { id=item.AccReqId }) |
            @Html.ActionLink("D", "Details", new { id=item.AccReqId }) |
            @Html.ActionLink("D", "Delete", new { id=item.AccReqId })
        </td>*@
    </tr>
}

</table>


  
@* Pagination *@
<div class="row-fluid pagination-botton">
    <div class="span6">
        <a id="btnEdit" href="@Url.Action("Edit")" class = "btn btn-warning"><i class="icon-pencil icon-white"></i> Editar Pedido</a>
        <a id="btnDel" href="@Url.Action("Edit")" class = "btn btn-danger"><i class="icon-remove icon-white"></i> Eliminar Pedido</a>
        @*@Html.ActionLink("Editar Pedido", "Edit", null, new { @class = "btn btn-warning", id="btnEdit"})
        @Html.ActionLink("Eliminar Pedido", "Delete", null, new { @class = "btn btn-danger", id="btnDel" })*@
    </div>
    <div class="span6" style="text-align: right; padding-right: 20px;">
        <div class="pagination" style="margin: 0;">
            <ul>
                @if (Model.HasPreviousPage)
                {
                    <li>@Html.ActionLink("<<", "Index", new { page = 1 },  new { @class = "" })</li>
                    <li>@Html.ActionLink("<", "Index", new { page = Model.PageNumber - 1 },  new { @class = "" })</li>
                    <li class="">
                        <a href="#" data-original-title="" title="" class="">
                            Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                        </a>
                    </li>                    
                }
                else
                {
                    <li class="disabled"><a href="#" data-original-title="" title="" class="">«</a></li> 
                    <li class="disabled"><a href="#" data-original-title="" title="" class=""><</a></li> 
                    <li class="">
                        <a href="#" data-original-title="" title="" class="disabled">
                            Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                        </a>
                    </li>   
                }
                @if (Model.HasNextPage)
                {
                    <li>@Html.ActionLink(">", "Index", new { page = Model.PageNumber + 1 },  new { @class = "" })</li> 
                    <li>@Html.ActionLink(">>", "Index", new { page = Model.PageCount },  new { @class = "" })</li> 
                }
                else
                {
                    <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">></a></li> 
                    <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">»</a></li>
                }
            </ul>
        </div>

    </div>
</div>


@Scripts.Render("~/bundles/culturam")





